import superagent from 'superagent';

export interface Anaylzer {
    anaylzer: (html: string) => string;
}

class Crowller {
    private async getRawHtml() {
        const result = await superagent.get(this.url);
        return result.text;
    }

    public async initSpliderProcess() {
        const html = await this.getRawHtml();
        return this.anaylzer.anaylzer(html);
    }

    constructor(private url: string, private anaylzer: Anaylzer) { }
}

export default Crowller;